﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using log4net;
using RealState.BLL;
using RealState.BusinessObjects;

namespace RealState.W
{
    public partial class ListContents : System.Web.UI.Page
    {
        private VwContentsBLL contentsBLL;
        protected ILog log = LogManager.GetLogger("ListContents");
        private static string cid=string.Empty,title=string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
             cid = Convert.ToString(Request.QueryString["CID"]);
             title = Convert.ToString(Request.QueryString["TITLE"]);
             Label1.Text = title;
             if (!Page.IsPostBack)
             {
                 LoadContent(cid);
             }
        }
        public void LoadContent(string cid)
        {
            contentsBLL = new VwContentsBLL();
            try
            {
                Repeater1.DataSource = contentsBLL.GetViewContents().Where(v => v.CategoryId == Convert.ToInt32(cid)).ToList();
                Repeater1.DataBind();
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
            }
            finally {
                contentsBLL = null;
            }
        }
    }
}
